package com.demo.ex04.one2one.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

//import org.hibernate.annotations.Cascade;
//import org.hibernate.annotations.CascadeType;

import com.demo.common.entity.BaseEntity;

@Entity
@Table(name="t_body")
public class Body extends BaseEntity<Long>{
	
	
	private String bodyCode;

	//建立关联关系
	private Heart heart;

	
	public String getBodyCode() {
		return bodyCode;
	}
	
	@OneToOne(cascade= CascadeType.ALL)
//	@JoinColumn(默认)
//	@JoinTable(name="tr_body_heart",
//		joinColumns=@JoinColumn(name="body_id"),
//		inverseJoinColumns=@JoinColumn(name="heart_id")
//	)
//	@PrimaryKeyJoinColumn
//	@Cascade(value = {CascadeType.SAVE_UPDATE,  CascadeType.REMOVE})  
	public Heart getHeart() {
		return heart;
	}

	public void setHeart(Heart heart) {
		this.heart = heart;
	}

	public void setBodyCode(String bodyCode) {
		this.bodyCode = bodyCode;
	}

}
